package com.older.wptsb.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.older.wptsb.domain.po.HealthData;
import lombok.Data;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;


@Mapper
public interface HealthDataMapper extends BaseMapper<HealthData> {
    @Update({"<script>",
            "UPDATE health_data",
            "<set>",
            "<if test='communityId != null'>community_id = #{communityId},</if>",
            "<if test='elderName != null and elderName != \"\"'>elder_name = #{elderName},</if>",
            "<if test='heartRate != null'>heart_rate = #{heartRate},</if>",
            "<if test='bloodOxygen != null'>blood_oxygen = #{bloodOxygen},</if>",
            "<if test='bloodPressure != null'>blood_pressure = #{bloodPressure},</if>",
            "<if test='sleepQuality != null'>sleep_quality = #{sleepQuality},</if>",
            "<if test='createTime != null and createTime != \"\"'>create_time = #{createTime},</if>",
            "<if test='location != null and location != \"\"'>location = #{location},</if>",
            "<if test='alertLevel != null and alertLevel != \"\"'>alert_level = #{alertLevel},</if>",
            "</set>",
            "WHERE data_id = #{dataId}",
            "</script>"})
    void updateById1(HealthData healthData);
}
